const { default: p } = require("../../../../utils/platform");

// pages/im/com/custom-elem/custom-elem.js
Component({
  /**
   * 组件的属性列表
   */
  properties: {
    item: Object,
    userID: String,
    targetUserProfile: Object,
    isMine:  Boolean,
    targetAvatar: String,
    mineAvatar: String,
  },

  /**
   * 组件的初始数据
   */
  data: {},

  lifetimes: {
    // 生命周期函数，可以为函数，或一个在methods段中定义的方法名
    attached: function () {
      // debugger
    },
    moved: function () {},
    detached: function () {},
  },

  /**
   * 组件的方法列表
   */
  methods: {
    handleResponse(e) {
      this.triggerEvent("handleResponse", e.detail);
    },

    // 去投诉页面
    handleComplain(e) {
      wx.navigateTo({
        url: `/pages/im/complaintPage/complaintPage?cooperationId=${e.detail.cooperationId}&beComplaintedUser=${this.data.targetUserProfile.unionId}`,
      });
    },

    handleCopyHouse(e) {
      p.showModal({
        content: "发起复制房源信息？",
      }).then((res) => {
        if (!res.confirm) return;
        this.triggerEvent("handleCopyHouse", e.detail);
      });
    },
  },
});
